package com.fdb.efp.nls.service.dao;

import com.fdb.efp.nls.service.domain.LoanCompensationStatement;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface LoanCompensationStatementDao {
    int insert(LoanCompensationStatement record);

    int insertSelective(LoanCompensationStatement record);

	/* 批量插入代偿清单 */
	public int bathInsert(@Param("loanCompensationStatements") List<LoanCompensationStatement> loanCompensationStatements);

	/**
	 * 批量插入数据，如果主键存在那么更新数据
	 * @param loanCompensationStatements
	 * @return
	 */
	public int bathInsertOrUpdate(@Param("loanCompensationStatements") List<LoanCompensationStatement> loanCompensationStatements);

	/* 根据日期查询正式表批量代偿清单 */
	public List<LoanCompensationStatement> queryLoanCompensationStatementByDate(LoanCompensationStatement loanCompensationStatement);

	/* 根据拮据批量更新代偿状态 */
	public int bathUpdateLoanCompensationStatement(@Param("list") List<LoanCompensationStatement> loanCompensationStatements);

	/* 查询各类本金，利息和 */
	public Map<String, BigDecimal> querySumBal(LoanCompensationStatement loanCompensationStatement) throws Exception;

	/**
	 * 批量通过借据号更新对账明细: <br>
	 *
	 * 0.1:caoxin:2019/4/8 19:59: TODO: <br>
	 * @author caoxin
	 * @return
	 * @since 2019/4/8 19:59
	 * @date 2019/4/8 19:59
	 * @version 0.1
	 */

	int updateBatchByBillNo(@Param("list") List<LoanCompensationStatement> loanCompensationStatements);
	/**
	 * 通过借据号更新对账明细: <br>
	 *
	 * 0.1:caoxin:2019/4/10 10:21: TODO: <br>
	 * @author caoxin
	 * @return
	 * @since 2019/4/10 10:21
	 * @date 2019/4/10 10:21
	 * @version 0.1
	 */

	int updateByBillNo(LoanCompensationStatement loanCompensationStatement);
	/**
	 * 通过对账状态和日期统计对账明细数目: <br>
	 *
	 * 0.1:caoxin:2019/4/4 9:46: TODO: <br>
	 * @author caoxin
	 * @return
	 * @since 2019/4/4 9:46
	 * @date 2019/4/4 9:46
	 * @version 0.1
	 */
	int countLoanCompensationStatementByCheckState(LoanCompensationStatement loanCompensationStatement);

	/**
	 * 
	 * TODO 根据日期修改对账状态<br>
	 * 0.1:wanglihua:2019年4月15日 上午11:21:27:TODO <br>
	 * @author wanglihua
	 * @since 2019年4月15日 上午11:21:27
	 * @date 2019年4月15日 上午11:21:27
	 * @version 0.1 初始为0.1,后续变更则修改
	 * @param successFlag 
	 */
	int timeUpdateLoanCompensationStatement(@Param("createTime") String curDate, @Param("compensationSts") String successFlag);
}